home *** CD-ROM | disk | FTP | other *** search
Text File | 2011-10-17 | 36.4 KB | 1,277 lines |
- class classes.bro.BroShip2
- {
- var tX;
- var x;
- var tY;
- var y;
- var clip;
- var w;
- var h;
- var weapon;
- var trans;
- var colorTrans;
- var colorVars;
- var life;
- var fireDir;
- var shotX;
- var shotY;
- var dirXArray;
- var dirYArray;
- var dirX;
- var dirY;
- var destX;
- var destY;
- var xyMetFunction;
- var handState;
- var baseSpeed = 6;
- var speed = 6;
- var fire = false;
- var d = 999990;
- var c = 0;
- var fc = 0;
- var shotID = 10000;
- var xA = 0;
- var yA = 0;
- var f2 = "";
- var facing = "R";
- var hc = 0;
- var fireFreq = 11;
- var fireFreqOrig = 11;
- var shieldOn = false;
- var inv = false;
- var control = true;
- var exit = false;
- var tagTeaming = false;
- var bg = false;
- var gesture = false;
- var sl = "top";
- var ofc = 0;
- var endFire = false;
- var hover = true;
- function BroShip2(px, py)
- {
- this.tX = this.x = px;
- this.tY = this.y = py;
- this.clip = _root.attachMovie("broShip2","broShip2Clip",this.d);
- this.w = this.clip._width;
- this.h = this.clip._height;
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.weapon = _root.bro2Weapon;
- this[this.weapon]();
- this.trans = new flash.geom.Transform(this.clip);
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.colorVars = new Object();
- this.life = _root.bro2Life;
- if(_root.bro2ShipVar == 1)
- {
- this.clip.body.shipStyles.gotoAndStop(_root.bro2ShipLevel);
- if(_root.level == 1 && _root.shipPass && (_root.bro2ShipLevel == 2 || _root.bro2ShipLevel == 3) || _root.level == 2 && _root.bro2ShipLevel == 3)
- {
- _root.audio.playLevel2("tagTeam1",20);
- this.colorFlash(255,255,255,30);
- _root.shipPass = false;
- }
- }
- else
- {
- this.clip.body.shipStyles.gotoAndStop(_root.bro2ShipVar);
- }
- var _loc3_ = _root.bro2ShipLevel <= 3 ? 1 + (_root.bro2ShipLevel - 1) * 2 : 1 + (_root.bro2ShipLevel - 4) * 2;
- this.baseSpeed = this.speed = 5 + _loc3_;
- }
- function colorFlash(r, g, b, cMax)
- {
- this.colorVars.c = 0;
- this.colorVars.r = r;
- this.colorVars.g = g;
- this.colorVars.b = b;
- this.colorVars.cMax = cMax;
- this.colorVars.flashing = true;
- }
- function nudge(pxA, pyA, pscale)
- {
- if((this.c == 0 || this.c > 5) && !this.inv)
- {
- this.c = 0;
- var _loc2_ = pscale / 150;
- this.xA = pxA * _loc2_;
- this.yA = pyA * _loc2_;
- this.f2 = "nudging";
- }
- }
- function nudging()
- {
- this.xA *= 0.75;
- this.yA *= 0.75;
- this.c = this.c + 1;
- if(this.c == 20)
- {
- this.xA = this.yA = 0;
- this.f2 = "";
- this.c = 0;
- }
- }
- function powerUp(type)
- {
- if(type.substr(0,10) == "speedBoost")
- {
- var _loc3_ = Number(type.substr(10));
- this.speedBoost(_loc3_ * 300);
- }
- else if(type.substr(0,11) == "weaponBoost")
- {
- _loc3_ = Number(type.substr(11));
- this.weaponBoost(_loc3_ * 200);
- }
- else
- {
- this[type]();
- }
- }
- function coin1()
- {
- _root.coins.addTo(1);
- this.colorFlash(200,200,200,10);
- }
- function coin5()
- {
- _root.coins.addTo(5);
- this.colorFlash(200,200,200,10);
- }
- function coin10()
- {
- _root.coins.addTo(10);
- this.colorFlash(200,200,0,10);
- }
- function coin25()
- {
- _root.coins.addTo(25);
- this.colorFlash(200,200,0,10);
- }
- function stealCoins(num)
- {
- if(!this.shieldOn && !this.inv)
- {
- _root.audio.playLevel2("coinDrain2",25);
- var _loc4_ = random(num) + 2;
- if(_root.coins.num - _loc4_ < 0)
- {
- _loc4_ = _root.coins.num;
- }
- _root.coins.addTo(-1 * _loc4_);
- var _loc3_ = 0;
- while(_loc3_ < _loc4_)
- {
- _root.fxID = _root.fxID + 1;
- _root["coinDrain" + _root.fxID] = new classes.fx.CoinDrain(this.x + 6,this.y + 6,_root.fxID);
- _root.addFX("coinDrain" + _root.fxID);
- _loc3_ = _loc3_ + 1;
- }
- }
- }
- function gem1()
- {
- _root.gems.addTo(1);
- this.colorFlash(40,255,180,15);
- }
- function gem2()
- {
- _root.gems.addTo(1);
- this.colorFlash(0,90,200,15);
- }
- function gem3()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,50,0,15);
- }
- function gem4()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,170,30,15);
- }
- function gem5()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,100,255,15);
- }
- function gem6()
- {
- _root.gems.addTo(1);
- this.colorFlash(0,255,180,15);
- }
- function smartBomb()
- {
- _root.smartBomb.gotoAndPlay(2);
- var _loc2_ = 1;
- var _loc3_ = _root.chars.length;
- var _loc4_ = _root.chars.slice();
- while(_loc2_ < _loc3_)
- {
- _root[_loc4_[_loc2_]].bombed(20);
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- _loc3_ = _root.enemyShots.length;
- _loc4_ = _root.enemyShots.slice();
- while(_loc2_ < _loc3_)
- {
- _root[_loc4_[_loc2_]].bombed();
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- _loc3_ = _root.FX.length;
- _loc4_ = _root.FX.slice();
- while(_loc2_ < _loc3_)
- {
- _root[_loc4_[_loc2_]].bombed();
- _loc2_ = _loc2_ + 1;
- }
- }
- function superP()
- {
- this.weaponBoost(600);
- this.speedBoost(600);
- this.shield();
- }
- function shield()
- {
- if(!this.shieldOn)
- {
- _root.shield = new classes.misc.Shield();
- _root.addPowerUp("shield");
- this.shieldOn = true;
- }
- else if(_root.shield.out)
- {
- _root.shield.renew();
- }
- this.colorFlash(70,180,250,30);
- }
- function rampage()
- {
- var _loc2_ = 0;
- var _loc3_ = _root.powerUps.length;
- while(_loc2_ < _loc3_)
- {
- if(_root.powerUps[_loc2_] == "rampage")
- {
- _root.removePowerUp("rampage");
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- _root.rampage = new classes.misc.Rampage(300);
- _root.addPowerUp("rampage");
- }
- function weaponBoost(num)
- {
- if(this.weapon == "laserA" || this.weapon == "doubleLaserA" || this.weapon == "tripleLaserA" || this.weapon == "bigLaser" || this.weapon == "twistLaser" || this.weapon == "tripleTwistLaser")
- {
- if(_root.currentBoost == "rapidFire")
- {
- _root.removePowerUp("rapidFire");
- }
- _root.currentBoost = "rapidFire";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- if(this.weapon != "bigLaser")
- {
- _root.rapidFire = new classes.misc.RapidFire(num,false);
- }
- else
- {
- _root.rapidFire = new classes.misc.RapidFire(num,true);
- }
- _root.addPowerUp("rapidFire");
- }
- if(this.weapon == "rapidLaser" || this.weapon == "doubleRapidLaser")
- {
- if(_root.currentBoost == "laserBoost")
- {
- _root.removePowerUp("laserBoost");
- }
- _root.currentBoost = "laserBoost";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- _root.laserBoost = new classes.misc.LaserBoost(num);
- _root.addPowerUp("laserBoost");
- }
- if(this.weapon == "superLaser")
- {
- if(_root.currentBoost == "superRapidFire")
- {
- _root.removePowerUp("superRapidFire");
- }
- _root.currentBoost = "superRapidFire";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- _root.superRapidFire = new classes.misc.SuperRapidFire(num);
- _root.addPowerUp("superRapidFire");
- }
- this.colorFlash(255,125,0,30);
- }
- function checkBoost()
- {
- if(_root.currentBoost != "")
- {
- _root.removePowerUp(_root.currentBoost);
- _root.currentBoost = "";
- _root.laserPower = 8;
- }
- }
- function doubleLaserA()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 11;
- this.fireFreqOrig = 11;
- _root.bro2Weapon = this.weapon = "doubleLaserA";
- this.colorFlash(200,200,0,30);
- }
- function tripleLaserA()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 11;
- this.fireFreqOrig = 11;
- _root.bro2Weapon = this.weapon = "tripleLaserA";
- this.colorFlash(255,160,0,30);
- }
- function rapidLaser()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 4;
- this.fireFreqOrig = 4;
- _root.bro2Weapon = this.weapon = "rapidLaser";
- this.colorFlash(0,230,190,30);
- }
- function twistLaser()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 10;
- this.fireFreqOrig = 10;
- _root.bro2Weapon = this.weapon = "twistLaser";
- this.colorFlash(100,200,230,30);
- }
- function tripleTwistLaser()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 10;
- this.fireFreqOrig = 10;
- _root.bro2Weapon = this.weapon = "tripleTwistLaser";
- this.colorFlash(100,200,230,30);
- }
- function bigLaser()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 9;
- this.fireFreqOrig = 9;
- _root.bro2Weapon = this.weapon = "bigLaser";
- this.colorFlash(0,130,255,30);
- }
- function superLaser()
- {
- this.checkBoost();
- _root.rapidVar = 3;
- this.fireFreq = 5;
- this.fireFreqOrig = 5;
- _root.bro2Weapon = this.weapon = "superLaser";
- this.colorFlash(255,255,255,30);
- }
- function lifeUp()
- {
- if(this.life + 25 > 100)
- {
- _root.lifeMeter.adjust(this.life,100 - this.life);
- this.life = 100;
- }
- else
- {
- _root.lifeMeter.adjust(this.life,25);
- this.life += 25;
- }
- this.colorFlash(255,75,255,30);
- }
- function lifeMax()
- {
- _root.lifeMeter.adjust(this.life,100 - this.life);
- this.life = 100;
- this.colorFlash(255,0,0,30);
- }
- function speedBoost(num)
- {
- var _loc3_ = 0;
- var _loc4_ = _root.powerUps.length;
- while(_loc3_ < _loc4_)
- {
- if(_root.powerUps[_loc3_] == "speedBoost")
- {
- _root.removePowerUp("speedBoost");
- break;
- }
- _loc3_ = _loc3_ + 1;
- }
- _root.speedBoost = new classes.misc.SpeedBoost(num);
- _root.addPowerUp("speedBoost");
- this.colorFlash(0,255,0,60);
- }
- function hit(pxMov, pyMov, pscale, ppower)
- {
- var _loc7_ = pxMov;
- var _loc8_ = pyMov;
- var _loc9_ = pscale;
- var _loc4_ = _root.bro2ShipLevel <= 3 ? 1 - (_root.bro2ShipLevel - 1) * 0.2 : 1 - (_root.bro2ShipLevel - 4) * 0.2;
- if(_root.bro2ShipVar == 3)
- {
- _loc4_ = 0.5;
- }
- var _loc5_ = ppower * _loc4_;
- if(this.shieldOn && !this.inv)
- {
- _root.shield.hit();
- }
- else if(!this.inv)
- {
- var _loc6_ = this.life;
- this.life -= _loc5_;
- if(this.life < 1)
- {
- _root.bro2Life = 0;
- _root.audio.playLevel2("broShip2X",_root.randRange(30,40));
- this.inv = true;
- this.clip.gun._visible = false;
- this.clip.fx._visible = false;
- this.colorTrans.redOffset = 0;
- this.colorTrans.greenOffset = 0;
- this.colorTrans.blueOffset = 0;
- this.trans.colorTransform = this.colorTrans;
- this.clip.body.gotoAndPlay("explode");
- this.control = false;
- this.facing = "switch";
- this.fireDir = "";
- var _loc3_ = 0;
- while(_loc3_ < 5)
- {
- if(_root.bro2ShipVar == 1)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip2_" + _root.bro2ShipLevel]);
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip2B_" + _root.bro2ShipLevel]);
- }
- else if(_root.bro2ShipVar == 7)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShipBlack"]);
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShipBlackB"]);
- }
- else
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"BroShip2_3B"]);
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"broShip2B_3B"]);
- }
- _loc3_ = _loc3_ + 1;
- }
- _root.bro2ShipVar = 1;
- }
- else
- {
- _root.lifeMeter.adjust(_loc6_,-1 * _loc5_);
- this.nudge(_loc7_,_loc8_,_loc9_);
- this.inv = true;
- this.colorFlash(255,0,0,20);
- _root.audio.playLevel3("broHit" + (random(3) + 1),_root.randRange(7,14));
- }
- }
- }
- function explosion()
- {
- _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-70,70),this.y + this.clip._height / 2 + _root.randRange(-70,70),_root.randRange(50,140),_root.randRange(70,100)]);
- }
- function shipToJetPack()
- {
- _root.bro2 = new classes.bro.Bro2(this.x + 6,this.y + 3);
- _root.addChar("bro2");
- _root.char = "bro2";
- _root.shield = new classes.misc.Shield();
- _root.addPowerUp("shield");
- _root[_root.char].shieldOn = true;
- if(_root.lastBoss && _root.char2 == "broShip1")
- {
- var _loc3_ = this.x >= 500 ? -50 : 1020;
- var _loc4_ = this.x >= 500 ? "R" : "L";
- _root.broShip1 = new classes.bro.BroShip1(_loc3_,280);
- _root.addChar("broShip1");
- _root.broShip1.tagTeam(_loc4_);
- }
- else if(_root.char2 == "broShip1" && !_root.broShip1.tagTeaming)
- {
- _root.rescue = true;
- if(!_root.boss && !_root.broShip1.bg)
- {
- _root.broAction([7]);
- }
- }
- }
- function removeShip()
- {
- _root.removeChar("broShip2");
- }
- function fire_laserA()
- {
- _root.audio.playLevel5("laserA" + (random(5) + 1),random(4) + 6);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_twistLaser()
- {
- _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("twistLaser" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("twistLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_tripleTwistLaser()
- {
- _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["twistLaserB" + this.shotID] = new classes.bro.TwistLaserB(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("twistLaserB" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("twistLaserC" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("twistLaserC" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_doubleLaserA()
- {
- _root.audio.playLevel5("doubleLaserA" + (random(5) + 1),random(10) + 8);
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -6;
- var _loc5_ = 0;
- var _loc3_ = 6;
- }
- else
- {
- _loc6_ = -6;
- _loc4_ = 0;
- _loc5_ = 6;
- _loc3_ = 0;
- }
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_tripleLaserA()
- {
- _root.audio.playLevel5("tripleLaserA" + (random(5) + 1),random(10) + 8);
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -3;
- var _loc5_ = 0;
- var _loc3_ = 3;
- }
- else
- {
- _loc6_ = -3;
- _loc4_ = 0;
- _loc5_ = 3;
- _loc3_ = 0;
- }
- this.shotID = this.shotID + 1;
- _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,1,this.shotID);
- _root.addBroShot("spreadLaserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,2,this.shotID);
- _root.addBroShot("spreadLaserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_rapidLaser()
- {
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -6;
- var _loc5_ = 0;
- var _loc3_ = 6;
- }
- else
- {
- _loc6_ = -6;
- _loc4_ = 0;
- _loc5_ = 6;
- _loc3_ = 0;
- }
- _root.audio.playLevel5("rapidLaser" + (random(5) + 1),random(30) + 10);
- this.shotID = this.shotID + 1;
- _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
- _root.addBroShot("rapidLaser" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("rapidLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_bigLaser()
- {
- _root.audio.playLevel5("bigLaser" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["bigLaser" + this.shotID] = new classes.bro.BigLaser(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("bigLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go2");
- if(this.fireDir == "U")
- {
- this.nudge(0,2,100);
- }
- else if(this.fireDir == "D")
- {
- this.nudge(0,-2,100);
- }
- else if(this.fireDir == "L")
- {
- this.nudge(2,0,100);
- }
- else
- {
- this.nudge(-2,0,100);
- }
- }
- function fire_superLaser()
- {
- _root.audio.playLevel5("superLaser" + (random(3) + 1),random(10) + 8);
- if(this.sl == "top")
- {
- this.sl = "bot";
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc4_ = 0;
- var _loc3_ = 6;
- }
- else
- {
- _loc4_ = 6;
- _loc3_ = 0;
- }
- }
- else
- {
- this.sl = "top";
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- _loc4_ = 0;
- _loc3_ = -6;
- }
- else
- {
- _loc4_ = -6;
- _loc3_ = 0;
- }
- }
- this.shotID = this.shotID + 1;
- _root["superLaserA" + this.shotID] = new classes.bro.SuperLaserA(this.shotX + _loc4_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("superLaserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("superLaserB" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("superLaserB" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go2");
- if(this.fireDir == "U")
- {
- this.nudge(0,2,100);
- }
- else if(this.fireDir == "D")
- {
- this.nudge(0,-2,100);
- }
- else if(this.fireDir == "L")
- {
- this.nudge(2,0,100);
- }
- else
- {
- this.nudge(-2,0,100);
- }
- }
- function action1()
- {
- this.control = false;
- this.dirXArray = ["L"];
- this.dirYArray = ["","","U","U","D"];
- this.changeDir();
- this.f2 = "wander";
- this.fireDir = "";
- }
- function action2()
- {
- this.gotoXY(0,80,"action2B");
- this.dirX = "";
- }
- function action2B()
- {
- this.fireDir = "R";
- }
- function action3()
- {
- this.dirXArray = ["R"];
- this.dirYArray = ["","D","D"];
- this.changeDir();
- this.f2 = "wander";
- this.fireDir = "";
- }
- function action4()
- {
- this.gotoXY(0,150,"action4B");
- this.clip.gotoAndPlay("faceLfireL");
- this.dirX = "L";
- this.fireDir = "L";
- this.exit = true;
- }
- function action4B()
- {
- this.dirX = "L";
- this.fireDir = "";
- }
- function action5()
- {
- this.goBG();
- this.gotoXY(260,0,"action5B");
- }
- function goBG()
- {
- this.clip.swapDepths(9885);
- this.bg = true;
- this.control = false;
- this.exit = true;
- this.speed *= 0.8;
- this.colorTrans.redOffset = -75;
- this.colorTrans.greenOffset = -75;
- this.colorTrans.blueOffset = -75;
- this.trans.colorTransform = this.colorTrans;
- this.clip._xscale = 66;
- this.clip._yscale = 66;
- this.fireDir = "";
- }
- function action5B()
- {
- this.gotoXY(0,800);
- }
- function action7()
- {
- this.goBG();
- this.facing = _root["advanceDir" + _root.level];
- if(_root["advanceDir" + _root.level] == "L")
- {
- this.gotoXY(-300,0);
- }
- else
- {
- this.gotoXY(1300,0);
- }
- }
- function action11()
- {
- this.exit = true;
- this.facing = "L";
- this.gotoXY(-300,0);
- }
- function warpLeave()
- {
- this.control = false;
- this.exit = true;
- this.fireDir = "";
- this.facing = "L";
- this.gotoXY(-300,0);
- }
- function endPos()
- {
- this.xA = this.yA = 0;
- this.speed = 2;
- this.control = false;
- this.facing = "L";
- this.fireDir = "";
- this.gotoXY(450,250);
- }
- function endPos2()
- {
- this.xA = this.yA = 0;
- this.clip._x = this.x = this.tX = 450;
- this.gotoXY(0,435,"endPos3");
- }
- function endPos3()
- {
- this.xA = this.yA = this.speed = 0;
- this.gesture = true;
- this.f2 = "";
- this.clip._x = this.x = this.tX = 450;
- this.clip._y = this.y = this.tY = 435;
- this.hover = false;
- this.clip.body.gotoAndPlay("endOpen");
- }
- function finalFunction()
- {
- _root.endBGClip.clip.buzzShip._visible = true;
- _root.endBGClip.clip.buzzShip.play();
- }
- function endSeq(pdir)
- {
- this.tagTeaming = false;
- this.speed = this.baseSpeed = 7;
- this.exit = true;
- this.weapon = "rapidLaser";
- _root.bro2weapon = this.weapon;
- this[this.weapon]();
- this.facing = this.fireDir = pdir;
- this.control = false;
- var _loc3_ = this.facing != "L" ? 200 : 800;
- this.gotoXY(_loc3_,280);
- }
- function endSeqB()
- {
- this.gotoXY(0,_root.deathHeadClip._y);
- }
- function endSeqMove()
- {
- this.speed = this.baseSpeed = 10;
- this.endFire = true;
- this.gotoXY(_root.randRange(100,900),_root.randRange(100,500),"endSeqMove");
- }
- function endStill()
- {
- this.endFire = false;
- this.dirX = this.dirY = this.fireDir = "";
- this.f2 = "";
- }
- function appear()
- {
- this.life += _root.randRange(35,50);
- if(this.life > 100)
- {
- this.life = 100;
- }
- this.exit = true;
- this.inv = true;
- this.control = false;
- if(this.x < 0)
- {
- this.facing = "R";
- this.fireDir = "R";
- this.gotoXY(150,0,"giveControl");
- }
- else
- {
- this.facing = "L";
- this.fireDir = "L";
- this.gotoXY(850,0,"giveControl");
- }
- }
- function giveControl()
- {
- this.inv = false;
- this.control = true;
- this.exit = false;
- }
- function tagTeam(pdir)
- {
- this.speed *= 0.8;
- this.life += _root.randRange(25,50);
- if(this.life > 100)
- {
- this.life = 100;
- }
- this.inv = true;
- this.control = false;
- this.exit = true;
- this.tagTeaming = true;
- this.facing = pdir;
- if(pdir == "R")
- {
- this.gotoXY(1300,0);
- }
- else
- {
- this.gotoXY(-300,0);
- }
- }
- function getOut()
- {
- this.facing = "L";
- this.fireDir = "";
- this.exit = true;
- this.gotoXY(-300,0,"",true);
- }
- function wave()
- {
- this.gesture = true;
- this.clip.body.gotoAndPlay("wave");
- }
- function reanimate()
- {
- this.gesture = true;
- this.clip.body.gotoAndPlay("reanimate");
- }
- function positionForSwitch(pdestX)
- {
- this.control = false;
- this.gotoXY(pdestX,0,"action6B");
- this.fireDir = "";
- this.facing = "R";
- }
- function action6B()
- {
- this.gotoXY(0,_root.newShipClip._y);
- this.facing = "switch";
- }
- function shipUpgrade(shipType)
- {
- this.control = false;
- this.life = 100;
- if(shipType == "ship2")
- {
- this.speed = this.baseSpeed = 8;
- _root.bro2ShipLevel = 2;
- this.clip.body.shipStyles.gotoAndStop(2);
- this.clip.body.gotoAndPlay("close");
- }
- else if(shipType == "ship3")
- {
- this.speed = this.baseSpeed = 10;
- _root.bro2ShipLevel = 3;
- this.clip.body.shipStyles.gotoAndStop(3);
- this.clip.body.gotoAndPlay("close");
- }
- else
- {
- this.speed = this.baseSpeed = 10;
- _root.bro2ShipLevel = 3;
- _root.bro2ShipVar = 3;
- this.clip.body.shipStyles.gotoAndStop(8);
- this.clip.body.gotoAndPlay("close");
- }
- }
- function gotoXY(pdestX, pdestY, pmetFunction, pwave)
- {
- this.destX = pdestX;
- this.destY = pdestY;
- this.xyMetFunction = pmetFunction;
- var _loc2_ = pwave;
- if(this.destX != 0)
- {
- this.dirX = this.x <= this.destX ? "R" : "L";
- }
- if(this.destY != 0)
- {
- this.dirY = this.y <= this.destY ? "D" : "U";
- }
- this.f2 = "goingXY";
- if(_loc2_)
- {
- this.wave();
- }
- }
- function goingXY()
- {
- if(this.destX != 0 && Math.abs(this.x - this.destX) < this.speed + 1)
- {
- this.dirX = "";
- var _loc2_ = true;
- }
- if(this.destX == 0)
- {
- _loc2_ = true;
- }
- if(this.destY != 0 && Math.abs(this.y - this.destY) < this.speed + 1)
- {
- this.dirY = "";
- var _loc3_ = true;
- }
- if(this.destY == 0)
- {
- _loc3_ = true;
- }
- if(_loc2_ && _loc3_)
- {
- this[this.xyMetFunction]();
- }
- }
- function changeDir()
- {
- this.dirX = this.dirXArray[random(this.dirXArray.length)];
- this.dirY = this.dirYArray[random(this.dirYArray.length)];
- }
- function wander()
- {
- if(random(100) > 93)
- {
- this.changeDir();
- }
- }
- function main()
- {
- this[this.f2]();
- if(this.endFire)
- {
- if(random(30) == 0)
- {
- var _loc4_ = ["L","R","D","U","","","",""];
- this.fireDir = _loc4_[random(8)];
- }
- if(random(60) == 0)
- {
- this.dirX = this.dirY = "";
- this.f2 = "";
- }
- else if(random(45) == 0)
- {
- this.endSeqMove();
- }
- }
- if(this.control)
- {
- if(Key.isDown(_root.moveU))
- {
- this.tY = this.y - this.speed;
- this.handState = "FU";
- }
- if(Key.isDown(_root.moveD))
- {
- this.tY = this.y + this.speed;
- this.handState = "BD";
- }
- if(Key.isDown(_root.moveL))
- {
- this.tX = this.x - this.speed;
- this.handState = this.facing != "R" ? "FU" : "BD";
- }
- if(Key.isDown(_root.moveR))
- {
- this.tX = this.x + this.speed;
- this.handState = this.facing != "R" ? "BD" : "FU";
- }
- if(Key.isDown(_root.fireU))
- {
- this.fire = true;
- this.shotY = this.y - 6;
- this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
- this.fireDir = "U";
- }
- else if(Key.isDown(_root.fireD))
- {
- this.fire = true;
- this.shotY = this.y + 42;
- this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
- this.fireDir = "D";
- }
- else if(Key.isDown(_root.fireL))
- {
- this.fire = true;
- this.shotX = this.x - 6;
- this.shotY = this.y + 33;
- this.fireDir = this.facing = "L";
- }
- else if(Key.isDown(_root.fireR))
- {
- this.fire = true;
- this.shotX = this.x + 39;
- this.shotY = this.y + 33;
- this.fireDir = this.facing = "R";
- }
- else
- {
- this.fire = false;
- this.fireDir = this.facing != "R" ? "L" : "R";
- this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
- this.fc = this.fc + 1;
- }
- if(!this.gesture)
- {
- this.clip.body.gotoAndStop(this.handState);
- }
- }
- else
- {
- if(this.dirY == "U")
- {
- this.tY = this.y - this.speed;
- this.handState = "FU";
- }
- if(this.dirY == "D")
- {
- this.tY = this.y + this.speed;
- this.handState = "BD";
- }
- if(this.dirX == "L")
- {
- this.tX = this.x - this.speed;
- this.handState = this.facing != "R" ? "FU" : "BD";
- }
- if(this.dirX == "R")
- {
- this.tX = this.x + this.speed;
- this.handState = this.facing != "R" ? "BD" : "FU";
- }
- if(this.fireDir == "U")
- {
- this.fire = true;
- this.shotY = this.y - 6;
- this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
- }
- else if(this.fireDir == "D")
- {
- this.fire = true;
- this.shotY = this.y + 42;
- this.shotX = this.facing != "R" ? this.x + 18 : this.x + 14;
- }
- else if(this.fireDir == "L")
- {
- this.fire = true;
- this.shotX = this.x - 6;
- this.shotY = this.y + 33;
- this.facing = "L";
- }
- else if(this.fireDir == "R")
- {
- this.fire = true;
- this.shotX = this.x + 39;
- this.shotY = this.y + 33;
- this.facing = "R";
- }
- else
- {
- this.fire = false;
- var _loc3_ = this.facing != "R" ? "L" : "R";
- this.clip.gotoAndStop("face" + this.facing + "fire" + _loc3_);
- this.fc = this.fc + 1;
- }
- if(this.facing != "switch" && !this.gesture)
- {
- this.clip.body.gotoAndStop(this.handState);
- }
- }
- if(this.colorVars.flashing)
- {
- this.colorVars.c = this.colorVars.c + 1;
- this.colorTrans.redOffset = this.colorVars.r - this.colorVars.c * (this.colorVars.r / this.colorVars.cMax);
- this.colorTrans.greenOffset = this.colorVars.g - this.colorVars.c * (this.colorVars.g / this.colorVars.cMax);
- this.colorTrans.blueOffset = this.colorVars.b - this.colorVars.c * (this.colorVars.b / this.colorVars.cMax);
- if(this.colorVars.c >= this.colorVars.cMax)
- {
- this.colorVars.flashing = false;
- this.colorTrans.redOffset = 0;
- this.colorTrans.greenOffset = 0;
- this.colorTrans.blueOffset = 0;
- }
- this.trans.colorTransform = this.colorTrans;
- }
- if(!this.exit)
- {
- if(this.tX < 35)
- {
- this.tX = 35;
- }
- if(this.tX > 965 - this.w)
- {
- this.tX = 965 - this.w;
- }
- if(this.tY < 35)
- {
- this.tY = 35;
- }
- if(this.tY > 565 - this.h)
- {
- this.tY = 565 - this.h;
- }
- }
- else if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
- {
- if(this.tagTeaming)
- {
- _root.rescue = false;
- }
- _root.removeChar("broShip2");
- _root.bgWait.activateBro();
- if(_root.lastBoss && !_root.bgWaiting && this.bg)
- {
- _root.tagTeam([-50,280,"R"]);
- }
- }
- if(this.fire)
- {
- this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
- if(this.fc <= this.ofc)
- {
- this.fc = this.ofc + 1;
- }
- else
- {
- this.fc = this.fc + 1;
- }
- if(this.fc > this.fireFreq)
- {
- this.fc = 0;
- this["fire_" + this.weapon]();
- }
- this.ofc = this.fc;
- }
- if(this.tagTeaming)
- {
- _root.c = _root.c - 1;
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- if(_root[_root.char].f2 != "dying")
- {
- _root.audio.playLevel2("tagTeam1",20);
- this.speed = this.baseSpeed;
- this.control = true;
- this.exit = false;
- this.weapon = _root.bro2Weapon = _root.bro1Weapon;
- this[this.weapon]();
- this.inv = false;
- this.tagTeaming = false;
- _root.rescue = false;
- _root.char2 = _root.char;
- _root.char = "broShip2";
- _root.shield.tagTeam();
- _root.bro1Life = _root[_root.char2].life;
- _root[_root.char2].control = false;
- _root[_root.char2].inv = true;
- _root[_root.char2].exit = true;
- _root[_root.char2].fireDir = "";
- if(this.facing == "R")
- {
- _root[_root.char2].facing = "R";
- _root[_root.char2].gotoXY(1300,0,"",true);
- }
- else
- {
- _root[_root.char2].facing = "L";
- _root[_root.char2].gotoXY(-300,0,"",true);
- }
- }
- }
- }
- this.tX += this.xA;
- this.tY = !this.hover ? this.tY + this.yA : this.tY + this.yA + 0.3 * Math.sin(this.hc += 0.05);
- this.x = this.tX;
- this.y = this.tY;
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-